<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>商品列表</title>
<meta name="keywords" content="" />
<meta name="description" content="" />
<meta content="zh-cn" http-equiv="content-language" />
<meta content="" name="copyright" />
<%@ include file="/page/pc/include.jsp"%>

<!--[if lte IE 6]> 
<script type="text/javascript" src="<%=basePath%>/statics/js/PNG.js"></script> 
<script> 
PNG.fix('*'); 
</script> 
<![endif]-->
<%--已筛选条件的优化 --%>
<style type="text/css">
	.search-wrap {
	    width: 1200px;margin-bottom:10px;
	    text-align: left;
	    border-top: 1px solid #eee;
	    border-bottom: 1px solid #eee;
	    position: relative;
	    z-index: 1;
	    margin-top:3px;
	}
	.search-wrap dl {
	    width: 1178px;
	    border-top: 1px dotted #ddd;
	    padding: 10px 10px 5px 10px;
	    margin: 0;
	    overflow: hidden;
	    border-left: 1px solid #eee;
	    border-right: 1px solid #eee;
		border-top: none;
	}
	.search-wrap dl dt {
	    float: left;
	    width: 70px;
	    height: 24px;
	    line-height: 24px;
	    text-align: right;
	    padding: 0px 5px 5px 0;
	    color: #999;
	    overflow: hidden;
	}
	.search-wrap dl dd {
	    float: none;
	    padding: 0px 10px 0 0;
	    margin: 0;
	    overflow: hidden;
	}
	.search-wrap dl dd.moredd {
	    float: right;
	    text-align: left;
	    text-indent: 10px;
	    width: 110px;
	    padding: 0;
	}
	
	.search-wrap .selected-attr-dl .moredd {
	    text-align: right;line-height:26px
	}
	.search-wrap dl dd ul {
	    float: left;
	    padding: 0;
	    margin: 0;
	}
	.search-wrap dl dd .selected-attr {
	    float: left;
	    overflow: hidden;
	}
	.search-wrap dl dd ul li {
	    float: left;
	    padding: 0 20px 5px 5px;
	    line-height: 24px;
	    white-space: nowrap;
	}
	.search-wrap dl dd .selected-attr li {
	    float: left;
	    height: 24px;
	    margin: 0 5px 5px 0;
	    padding: 0;
	}
	.search-wrap dl dd .selected-attr li a {
	    display: block;
	    height: 22px;
	    line-height: 22px;
	    border-width: 1px;
	    border-style: solid;
	    border-color: #eee;
	    padding: 0 26px 0 4px;
	    position: relative;
	    z-index: 1;
	}
	.color {
	    color: /*main_color_start*/#E31939/*main_color_end*/;
	}
	.search-wrap dl dd .selected-attr li b {
	    font-weight: normal;
	}
	.search-wrap dl dd i {
	    float: left;
	    overflow: hidden;
	    width: 4px;
	    height: 1px;
	    margin: 12px 4px 0 0;
	    background: #ccc;
	}
	.search-wrap dl dd .selected-attr li i {
	    color: /*main_color_start*/#E31939/*main_color_end*/;
	}
	.search-wrap dl dd .selected-attr li i {
	    margin: 0;font-style:normal;
	    text-decoration: none;
	    display: block;
	    position: absolute;
	    right: 0;
	    top: 0px;
	    width: 22px;
	    height: 22px;
	    line-height: 20px;
	    text-align: center;
	    font-size: 18px;
	    background-color: #fff;
	}
	.search-wrap dl dd .selected-attr li a:hover{border:1px solid #E31939}
	.search-wrap dl dd .selected-attr li a:hover i{ color: #fff;background:#E31939;}
	.xz_part  ul li {
	float: left;
	width: 33.3%;
	height: 20px;
	margin-bottom: 5px
}

.c_box .c_left .bottom {
	display: inline-block;
	width: 100%;
	margin-top: 10px;
}

.c_box .c_left .bottom p .inputbtn1 {
	display: inline-block;
	line-height: 28px;
	height: 28px;
	width: 70px;
	border-radius: 2px;
	border: 1px solid #E74649;
	text-align: center;
	font-size: 13px;
	text-decoration: none;
	cursor: pointer;
	border: 0;
	outline: none;
	color: #FFF;
	background-color: #E74649;
}

.c_box .c_left .bottom p .inputbtn1:hover {
	opacity: 0.8
}

.xz_part  ul li input {
	display: none
}

.xz_part  ul li label i {
	display: inline-block;
	margin-right: 6px;
	width: 10px;
	height: 10px;
	border: 1px solid #cccccc;
	display: inline-block;
	vertical-align: middle;
	background: #fff;
}

.xz_part  ul li label.checked i {
	border-color: #e4393c;
	background: url('<%=basePath %>/statics/images/search.ele.png') no-repeat 9999px 9999px;
	background-position: -1px -108px;
}

.xz_part  ul li label span {
	display: inline-block;
	vertical-align: middle;
}

.xz_part  ul li label.checked span {
	color: #e4393c
}
</style>
</head>
<body style="background: #fff">
	<!---右侧工具栏开始-->
	<div class="fixedbox">
		<div class="rightbar">
			<div class="rightbar_con">


				<ul id="navs">


					<li class="hasdrop"><a href="${rootPath}/pc/shoppingcart/list" class="icon_cart"  target="_blank"><i class="icon_4"></i><span>购物车</span> </a></li>

					<li class="hasdrop"><a href="javascript:void(0)"><i class="icon_3"></i> </a>
						<div class="drop">
							<strong></strong>
							<div class="txt">
								<a href="javascript:void(0)">我的收藏</a>
							</div>
						</div></li>

					<%-- <li class="hasdrop"><a href="javascript:void(0)"><i class="icon_2"></i> </a>
						<div class="drop">
							<strong></strong>
							<div class="txt">
								<a href="<%=basePath%>/wx/browseRecord/toProductBrowseRecordPage">浏览记录</a>
							</div>
						</div></li> --%>
					<li class="hasdrop"
						style="position: fixed; right: 0; bottom: 0; width: 36px; background: #dd2726">
						<a href="javascript:void(0)" class="backtop"><i class="icon_6"></i><em>回顶</em>
					</a>
					</li>
				</ul>
			</div>
		</div>
	</div>
	<!---右侧工具栏结算-->



	<div class="wrap">

		<!---头部公共部分开始-->
		<div class="header">
			<jsp:include page="../header_top.jsp" />
			<div class="index_header">
				<div class="index_header_con">
					<h1>
						<a href="${rootPath}/pc/index"> <img
							src="${rootPath}/statics/images/logo.png" style="width:228px;height:49px;"/>
						</a>
					</h1>
					<div class="search_part">
							<div class="search_part1">
								<div class="input_txt">
									<input type="text" id="search_key" name="searchKey" class="inputstyle" placeholder="" value="${searchKey }"/>
								</div>
								<input type="button" onclick="javascript: doSearch();" class="inputbtn" value="搜 索" />
							</div>
						<div class="search_part2">
							<p>
								<span id="hot_search_key_name">热门搜索：</span>
							</p>
						</div>
					</div>
					<div class="cart_num">
						<p>
							<a href="${rootPath}/pc/shoppingcart/list"  target="_blank"><i></i><span>我的购物车</span><em id="shopCount">0</em></a>
						</p>
					</div>
				</div>
			</div>
			<div class="index_nav">
				<div class="index_nav_con">
					<div id="category" class="category">
						<div class="category-bg"></div>
						<h2>
							<a href="javascript:void(0)"> 企业商品分类 </a>
						</h2>
						<div class="cate-list">
							<ul id="J_category" load="1">
								<%--商品分类循环开始 --%>
								<%-- 
								<li onmouseover="this.className='hover'" onmouseout="this.className=''">
									<div class="cate-item">
										<h3>
											<a href="${rootPath}/pc/product/search">
												<i>
													<img src="${rootPath}/statics/images/all_product.png" style="width:20px;height:20px;" />
												</i>
												<span>全部商品</span>
												<em>&gt;</em>
											</a>
										</h3>
									</div>
								</li> 
								--%>
								<c:forEach items="${topCategoryList}" var="category">
									<li id="pop_Category_0" onmouseover="this.className='hover'" onmouseout="this.className=''">
										<div class="cate-item">
											<h3>
												<a href="javascript:void(0);">
													<i>
														<img src="${imgRootURL }${category.categoryImage }?x-oss-process=image/resize,m_pad,h_20,w_20" onerror="this.src='${rootPath}/statics/images/left_icon1.png'"/>
													</i>
													<span>${category.categoryName}</span>
													<em>&gt;</em>
												</a>
											</h3>
										</div>
										<div class="cate-list-expand categoryDiv_${category.id}">
											<div class="c_box">
												<div class="c_left">
													<%-- 品牌 begin --%>
													<c:if test="${not empty category.subBrandList }">
														<dl>
															<dt>品牌</dt>
															<dd>
																<div class="xz_part brand_ul">
																	<ul class="brand_ul_${category.id}">
																		<c:forEach items="${category.subBrandList}" var="brand">
																			<li id="brandLi_${category.id}_${brand.id}" onclick="javascript: doLiLabel('brandLi_${category.id}_${brand.id}'); reloadCategory('${category.id}');">
																				<input type="checkbox" class="temp_brand_${category.id}" value="${brand.id}" />
																				<label id="${category.id}" title="${brand.id}" big_category_id = "${category.id}">
																					<i></i>
																					<span>${brand.brandNameCh}</span>
																				</label>
																			</li>
																		</c:forEach>
																	</ul>
																</div>
															</dd>
														</dl>
													</c:if>
													<%-- 品牌 end --%>
													<dl>
														<dt>
															<a href="${rootPath}/pc/product/search?categoryId=${category.id}" target="_blank">${category.categoryName}</a>
														</dt>
														
														<c:if test="${not empty category.subCategoryList }">
															<dd>
																<div class="xz_part category_ul">
																	<ul class="temp_ul_${category.id}">
																		<c:forEach items="${category.subCategoryList}" var="subCategory">
																			<li id="categoryLi_${category.id}_${subCategory.id}" onclick="javascript: doLiLabel('categoryLi_${category.id}_${subCategory.id}');">
																				<input type="checkbox" value="${subCategory.id}" />
																				<label id="${category.id}" title="${subCategory.id}"  big_category_id = "${category.id}">
																					<i></i>
																					<span>${subCategory.categoryName}</span>
																				</label>
																			</li>
																		</c:forEach>
																	</ul>
																</div>
																<div class="bottom">
																	<p>
																		<input type="button" id="btnBrandCategorySearch_${category.id}" onclick="javascript: doProductSearch('${category.id}');" style="background-color:gray;" class="inputbtn1" value="搜索" />
																	</p>
																</div>
															</dd>
														</c:if>
													</dl>
												</div>
												<div class="c_right">
													<a href="${category.advertisementUrl }">
														<img src="${imgRootURL }${category.advertisementImage }"onerror="this.src='${rootPath}/statics/images/ed4.jpg'" />
													</a>
												</div>
											</div>
										</div>
									</li>
								</c:forEach>
								<%--商品分类循环结束 --%>
							</ul>
						</div>
					</div>
					<div class="site_nav">
						<ul>
							<li><a href="${rootPath}/pc/index">首页</a></li>
							<li><a href="${rootPath}/pc/my/quotation">报价单</a></li>
							<li><a href="${rootPath}/pc/product/search">全部商品</a></li>
							<li><a href="${rootPath}/pc/index#tag_5">新品上市</a></li>
							<li><a href="${rootPath}/pc/index#tag_4">热品采购</a></li>
							<%-- <li><a href="${rootPath}/pc/index#tag_6">品牌馆</a></li> --%>
						</ul>
					</div>
				</div>
			</div>
		</div>
		<!---头部公共部分结束-->
		<div class="site_wrap11">
			<div class="site_wrap11_con">
				<%--
				<div class="pathinfo">
					<p>
						<a id="filter_condition" href="javascript:void(0);">筛选条件:</a>
						<c:forEach items="${filterNameList}" var="item">
							<span style="border:1px solid gray;padding:3px;"><span>${item.filterName}:${item.filterValue}</span><a id="${item.filterId}" class="close_filter">X</a></span>
						</c:forEach>
					</p>
				</div>
				--%>
				
		        <div class="search-wrap" id="attr-list-ul">
					<!--已选条件-->
					<dl class="selected-attr-dl" style="border-bottom: none;">
						<dt id="filter_condition">已选条件：</dt>
						<dd class="moredd">
							<a id="revoke_all_filter" href="javascript:void(0)">全部撤销</a>
						</dd>
						<dd>
							<ul class="selected-attr">
								<c:forEach items="${filterNameList}" var="item">
									<li>
										<a href="javascript:void(0)">
											<b id="filter_name">${item.filterName}</b>：
											<b id="filter_value" class="color">${item.filterValue}</b>
											<i id="${item.filterId}" name="close_filter">×</i>
										</a>
									</li>
									<%--
									<span style="border:1px solid gray;padding:3px;"><span>${item.filterName}:${item.filterValue}</span><a id="${item.filterId}" class="close_filter">X</a></span>
									--%>
								</c:forEach>
							</ul>
						</dd>
					</dl>
				</div>
				
				<div class="category_part">
					<dl>
						<dt>
							<strong><i>品牌：</i></strong>
							<div class="txt1">
								<div class="brand_nav">
									<p>
										<a href="javascript:void(0)" class="current">所有品牌</a><a href="javascript:void(0)">A</a><a
											href="javascript:void(0)">B</a><a href="javascript:void(0)">C</a><a href="javascript:void(0)">D</a><a href="javascript:void(0)">E</a><a
											href="javascript:void(0)">F</a><a href="javascript:void(0)">G</a><a href="javascript:void(0)">H</a><a href="javascript:void(0)">I</a><a
											href="javascript:void(0)">J</a><a href="javascript:void(0)">K</a><a href="javascript:void(0)">L</a><a href="javascript:void(0)">M</a><a
											href="javascript:void(0)">N</a><a href="javascript:void(0)">O</a><a href="javascript:void(0)">P</a><a href="javascript:void(0)">Q</a><a
											href="javascript:void(0)">R</a><a href="javascript:void(0)">S</a><a href="javascript:void(0)">T</a><a href="javascript:void(0)">U</a><a
											href="javascript:void(0)">V</a><a href="javascript:void(0)">W</a><a href="javascript:void(0)">X</a><a href="javascript:void(0)">Y</a><a
											href="javascript:void(0)">Z</a>
									</p>
								</div>
								<div class="brand_list1">
									<div class="brand_list1_con">
										<ul>
											<c:forEach items="${brandList}" var="brand">
												<c:choose>
													<c:when test="${brandId eq brand.id }">
														<li class="selected" brandId = "${brand.id}" brandName = "${brand.brandNameCh}"><a href="javascript:void(0)"  ><b><img src="${imgRootURL}${brand.brandImage}?x-oss-process=image/resize,m_fill,h_36,w_102"/></b></a></li>
													</c:when>
													<c:otherwise>
														<li brandId = "${brand.id}" brandName = "${brand.brandNameCh}"><a href="javascript:void(0)"  ><b><img src="${imgRootURL}${brand.brandImage}?x-oss-process=image/resize,m_fill,h_36,w_102"/></b></a></li>
													</c:otherwise>
												</c:choose>
											</c:forEach>
										</ul>
									</div>
								</div>
								
								<c:forEach items="${showBrandList}" var="brandList" varStatus="ind">
									<div class="brand_list1">
										<div class="brand_list1_con">
											<ul>
												<c:forEach items="${brandList}" var="brand">
													<c:choose>
													<c:when test="${brandId eq brand.id }">
														<li class="selected" brandId = "${brand.id}"><a href="javascript:void(0)" onclick="brandSearch('${brand.id}')"><b><img src="${imgRootURL}${brand.brandImage}?x-oss-process=image/resize,m_fill,h_36,w_102" /></b></a></li>
													</c:when>
													<c:otherwise>
														<li brandId = "${brand.id}"><a href="javascript:void(0)" onclick="brandSearch('${brand.id}')"><b><img src="${imgRootURL}${brand.brandImage}?x-oss-process=image/resize,m_fill,h_36,w_102" /></b></a></li>
													</c:otherwise>
												</c:choose>
												</c:forEach>
											</ul>
										</div>
									</div>
								</c:forEach>
								<div class="operate_part">
									<p>
										<input type="button" class="inputbtn1" value="确定" /><input
											type="button" class="inputbtn2" value="取消" />
									</p>
								</div>
								<div class="more_part">
									<p>
										<a href="javascript:void(0);" class="morebtn"><span class="a11">更多</span><span class="a12">收起</span><i class="a1"></i></a>
										<!-- <a href="javascript:void(0);" class="dxbtn"><span>多选</span><i class="a2"></i></a> -->
									</p>
								</div>

							</div>
						</dt>
						<dt>
							<strong><i>商品类型：</i></strong>
							<div class="txt1">
								<div class="brand_list2">
									<ul>
										<!-- 已选中的分类（可能是多个，如：11,23） -->
										<c:set var="categoryIdArr" value="" ></c:set>
										<c:if test="${not empty categoryId }">
											<c:set var="categoryIdArr" value="${ fn:split(categoryId, ',') }" ></c:set>
										</c:if>
										<c:forEach items="${categoryList}" var="category">
											<c:set var="isChecked" value="false"></c:set>
											<c:forEach items="${categoryIdArr }" var="cid">
												<c:if test="${cid eq category.id }">
													<c:set var="isChecked" value="true"></c:set>
												</c:if>
											</c:forEach>
											<c:choose>
												<c:when test="${isChecked }">
													<li class="category_li selected" categoryId="${category.id}"><a href="#" onclick="javascript: doCheckCategory('${category.id}');" >${category.categoryName}</a></li>
												</c:when>
												<c:otherwise>
													<li class="category_li" categoryId="${category.id}"><a href="#" onclick="javascript: doCheckCategory('${category.id}');" >${category.categoryName}</a></li>
												</c:otherwise>
											</c:choose>
										</c:forEach>
									</ul>
								</div>
							</div>
						</dt>
						
						<c:forEach items="${filterList}" var="filter">
							<dt>
								<strong><i>${filter.propertyName }：</i></strong>
								<div class="txt1">
									<div class="brand_list2">
										<ul>
											<c:forEach items="${filter.propertyValueList}" var="pv">
												<c:set var="isChecked" value="false"></c:set>
												<c:forEach items="${filterNameList}" var="checkFilter">
													<c:if test="${filter.propertyName eq checkFilter.filterName and pv eq checkFilter.filterValue }">
														<c:set var="isChecked" value="true"></c:set>
													</c:if>
												</c:forEach>
												<c:choose>
													<c:when test="${isChecked }">
														<li class="filter_li selected"  propertyName="${filter.propertyName}"  propertyValue="${pv}"><a href="javascript:void(0);">${pv}</a></li>
													</c:when>
													<c:otherwise>
														<li class="filter_li"  propertyName="${filter.propertyName}"  propertyValue="${pv}"><a href="javascript:void(0);">${pv}</a></li>
													</c:otherwise>
												</c:choose>
											</c:forEach>
										</ul>
									</div>
								</div>
							</dt>
						</c:forEach>
					</dl>
				</div>
				<div class="search_condition">
					<div class="left">
						<div class="xl_nav">
							<p>
								<a href="javascript: void(0)" onclick="javascript: doSort('SORT_NO', 'ASC');" <c:if test="${sortField eq 'SORT_NO' }"> class="current" </c:if>>综合<i></i></a>
								<a href="javascript: void(0)" onclick="javascript: doSort('MODIFY_TIME', 'DESC');"<c:if test="${sortField eq 'MODIFY_TIME' }"> class="current" </c:if>>新品<i></i></a>
								<a href="javascript: void(0)" onclick="javascript: doSort('BASE_PRICE', null);"<c:if test="${sortField eq 'BASE_PRICE' }"> class="current" </c:if>>价格
									<c:choose>
										<c:when test="${sortField eq 'BASE_PRICE' }">
											<img src="<%=basePath %>/statics/images/${sortType}.png" />
										</c:when>
										<c:otherwise>
											<em></em>
										</c:otherwise>
									</c:choose>
								</a>
							</p>
						</div>
						<div class="price_part">
							<ul>
								<li>
									<div class="inputbox">
										<strong>¥</strong>
										<p>
											<input type="text" id="tmpMinPrice"  onkeypress="minMaxPriceGo(event)" onkeydown="minMaxPriceGo()" class="inputstyle1" placeholder="" />
										</p>
									</div>
								</li>
								<li>-</li>
								<li>
									<div class="inputbox">
										<strong>¥</strong>
										<p>
											<input type="text" id="tmpMaxPrice" onkeypress="minMaxPriceGo(event)" onkeydown="minMaxPriceGo()" class="inputstyle1" placeholder="" />
										</p>
									</div>
								</li>
							</ul>
						</div>
						
					</div>
					<!-- <div class="right">
						<div class="f-pager">
							<span class="fp-text"> <b>1</b><em>/</em><i>2</i>
							</span> <a class="fp-prev disabled" href="javascript:;"> &lt; </a> <a
								class="fp-next" href="javascript:void(0)"> &gt; </a>
						</div>
					</div> -->
				</div>
				<div class="product_list">
					<ul>
						<c:forEach items="${productList}" var="product">
							<li>
								<div class="box11">
									<div class="pic">
										<a href="${rootPath}/pc/product/detail?productId=${product.id}"  target="_blank"> <img src="${imgRootURL}${product.mainImagePath}" />
										</a>
									</div>
									<div class="item-info">
										<h2>
											<em>￥</em><b><fmt:formatNumber type="number" value="${product.productPrice }" pattern="0.00" /></b>
										</h2>
										<p>
											<a href="${rootPath}/pc/product/detail?productId=${product.id}"  target="_blank">
												<c:if test="${product.isPointProduct eq 1}">
													<span class="label label-info" style="background-color: #3a87ad !important;" >积分商品</span>
												</c:if>
												<c:if test="${product.productStatus eq '2'}">
													<span class="label label-warning" >预售中</span>
												</c:if>
												<c:if test="${product.productStatus eq '0'}">
													<span class="label label-danger" >已售罄</span>
												</c:if>
												${product.productName }
											</a>
										</p>
									</div>
								</div>
							</li>
						</c:forEach>
					</ul>
				</div>
				
				
				
				<form id="product_search_form" name="product_search_form" action="${rootPath}/pc/product/search" method="post" >
					<input type="hidden" id="searchKeyHidden" name="searchKey" class="inputstyle" value="${searchKey }" placeholder="${searchKey}" />
					<%--类型id --%>
					<input type="hidden"  name="categoryId" id="categoryId" value="${categoryId}"/>
					<%-- <input type="hidden"  name="categoryIdStr" id="categoryIdStr" value="${categoryIdStr}"/> --%>
					<%--品牌参数 --%>
					<input type="hidden" id="brandId"  name="brandId" value="${brandId}"/>
					<input type="hidden" id="brandIds"  name="brandIds" value="${brandIds}"/>
					<%--筛选项 --%>
					<input type="hidden" id="propertyFilter"  name="propertyFilter" value="${propertyFilter}"/>
					<%--排序字段 --%>
					<input type="hidden" id="sortField"  name="sortField"  value="${sortField}"/>
					<%--排序类型 --%>
					<input type="hidden" id="sortType"  name="sortType"  value="${sortType}"/>
					<%--价格区间 --%>
					<input type="hidden" id="minPrice" name="minPrice" value="${minPrice}"/>
					<input type="hidden" id="maxPrice" name="maxPrice" value="${maxPrice}"/>
					
					<%--商品标签id --%>
					<input type="hidden"  name="productTag" id="productTag" value="${productTag}"/>
					
					<%--分页 --%>
					<jx:paging formID="product_search_form" isShowJumpToButton="true" isShowpageCount="true"></jx:paging>
				</form>
				
			</div>
		</div>

		<!---网站底部开始-->
		<jsp:include page="../footer.jsp?showQaFlag=0" /> 
		<!---网站底部结束-->
	</div>

	<script charset="utf-8" language="javascript" type="text/javascript" src="<%=basePath%>/statics/js/nav.js"></script>
<script type="text/javascript">
	//页面跳转
	function getLink(n){
		var $form = $("#product_search_form");
		var tmp_currentPage = '<input type="hidden" name="tmpCurrentPage" value="'+n+'"/>';
		var tmp_numPerPage = '<input type="hidden" name="tmpNumPerPage" value="'+$("#select_numPerPage").val()+'"/>';
		$form.append(tmp_currentPage);
		$form.append(tmp_numPerPage);
		$form.submit();
	}

	$(function() {
		/**
		 * 键盘点击事件，回车键，执行搜索
		 */
		$("#search_key").bind('keypress', function(event) {
			if (event.keyCode == "13") {
				doSearch();
			}
		});
		/**
		 * 获取购物车数量
		 */
		$.ajax({
			type: 'POST',
			url: rootPath + "/pc/shoppingcart/getShoppingcarCount",
			async: true,
			dataType: 'json',
			success: function(json) {
				if(json.code == '1') {
					$("#shopCount").html(json.data);
				}
			}
		});
	});
	/**
	 * 点击搜索
	 */
	function doSearch() {
		//清除其他条件
		$("li.filter_li").each(function(){
			$(this).remove();
		});
		$("#propertyFilter").val("");
		$("#product_search_form input").val('');
		//页面保存搜索关键词
		$('#searchKeyHidden').val($('#search_key').val()); 
		getLink(1);
	}
	
	/**
	 * 重新选择商品分类
	 */
	function doCheckCategory(categoryId) {
		if(categoryId) {
			$("#categoryId").val(categoryId);
			$("#searchKeyHidden").val("");
			$("#search_key").val("");
			getLink(1);
		}
	}

	$(function(){
		$('a.backtop').click(function(){
			  $('body,html').animate({scrollTop:0}, 1000);
		});
		$('.operate_part,.brand_nav').hide();
		// 选中状态
		$('.brand_list1 ul li').click(function(){
			//清除关键字搜索
			$('#searchKeyHidden').val("");
			$('#search_key').val("");
			
			$(this).toggleClass('selected');
			$("#brandId").val($(this).attr("brandId"));
			$("#product_search_form").submit();
			$("#filter_condition").after("<span style='border:1px solid gray;padding:3px;'><span>"+$(this).attr("brandName")+"</span><a>X</a></span>");
		});

		$('.ys_part ul li label').click(function(){
 			if($(this).hasClass('checked')){
                $(this).toggleClass('checked');
				$(this).parent().find('input').removeAttr("checked");
            }
            else{
                $(this).toggleClass('checked');
                $(this).parent().find('input').attr('checked','checked');
				
            }
		});	
		  
		$('.morebtn').click(function(){
			$(this).toggleClass('current');
			if($(this).hasClass('current') == true){
				$(this).parent().parent().parent().find('.brand_list1').addClass('current');
					$('.brand_nav').show();
				}else{
					$(this).parent().parent().parent().find('.brand_list1').removeClass('current');
					$('.brand_nav').hide();
				}
		});
		
		
		$('.dxbtn').click(function(){
			$(this).toggleClass('current');
			if($(this).hasClass('current') == true){
				$(this).parent().parent().parent().find('.brand_list1').addClass('current');
				$('.brand_nav,.operate_part').show();
			}else{
				$(this).parent().parent().parent().find('.brand_list1').removeClass('current');
				$('.brand_nav,.operate_part').hide();
			}
		});
	
		$('.xsq_part ul li a').click(function(){
			$(this).parent().toggleClass('selected');
			$(this).parent().siblings().removeClass('selected');
		});
		
		$('.operate_part p .inputbtn2').click(function(){
			$(this).parent().parent().parent().find('.brand_nav,.operate_part').hide();
			$(this).parent().parent().parent().find('.brand_list1').toggleClass('current');
			$(this).parent().parent().parent().find('.dxbtn').removeClass('current');
		});
		jQuery('.brand_nav p a').mouseover(function() { 
			TabSelect(".brand_nav p a", "div.brand_list1", "current", jQuery(this)) 
		});
		jQuery('.brand_nav p a').eq(0).trigger("mouseover");
		//sjQuery("div.brand_list1").eq(0).show();
		
		
		// 异步查询热门搜索关键字
		url = rootPath + "/pc/listHotSearchKey";
		$.ajax({
			type: 'POST',
			url: url,
			async: true,
			data: {},
			dataType: 'json',
			success: function(json) {
				if(json){
					for(var i = 0; i < json.length; i ++){
						var searchKey = $("<a href='javascript:void(0)' >"+json[i].keyIntro+"</a>");
						searchKey.click(function(){
							$("#search_key").val($(this).text());
							$('#searchKeyHidden').val($('#search_key').val()); 
							getLink(1);
							//$("#product_search_form").submit();
						});
						$("#hot_search_key_name").after(searchKey);
					}
				}
			}
		})
		
	});
	
	
	
	jQuery('#duice').click(function(){
		jQuery('.wthpop').show();
	})
	jQuery('.wthpop>p>span').click(function(){
		jQuery('.wthpop').hide()
	})
	
	// 删除已选择的筛选项
	$("i[name='close_filter']").each(function(){
		$(this).click(function(){
			var filter_name = $(this).closest("li").find("#filter_name").text();
			var filter_value = $(this).closest("li").find("#filter_value").text();
			var filter_id = $(this).attr("id").substring(2);
			$(this).closest("li").remove();
			if(filter_id == 'price') {
				//价格区间，重新
				$("#minPrice").val('');
				$("#maxPrice").val('');
			} else {
				if(filter_id == 'propertyFilter'){
					var propertyFilter = $("#propertyFilter").val();
					// 删除隐藏的条件筛选项
					if(propertyFilter && propertyFilter !="" && propertyFilter != null){
						var json = eval(propertyFilter);
						for(var i = 0 ;i < json.length; i ++){
							var item = json[i];
							if(item.propertyName == filter_name){
								json.splice(i,1);
								break;
							}
						}
					}
					$("#propertyFilter").val(JSON.stringify(json));
				}else{
					$("#"+filter_id).val("");
				}
			}
			//$("#product_search_form").submit();
			getLink(1);
		});
	});
	
	// 筛选项查询
	$("li.filter_li").each(function(){
		$(this).click(function(){
			//清除关键字搜索
			$('#searchKeyHidden').val("");
			$('#search_key').val("");
			
			var propertyName = $(this).attr("propertyName");
			var propertyValue = $(this).attr("propertyValue");
			var tmpFilter = [];
			var propertyFilter = $("#propertyFilter").val();
			var flag = false;
			var index = 0;
			if(propertyFilter && propertyFilter !="" && propertyFilter != null){
				var json = eval(propertyFilter);
				$.each(json,function(i,item){
					if(item.propertyName == propertyName){
						index = i;
						flag = true;
					}
					tmpFilter.push({"propertyName" : item.propertyName,"propertyValue" : item.propertyValue});
				});
			}
			if(flag){
				tmpFilter[index].propertyValue = propertyValue;
			}else{
				tmpFilter.push({"propertyName" : propertyName,"propertyValue" : propertyValue});
			}
			$("#propertyFilter").val(JSON.stringify(tmpFilter));
			//$("#product_search_form").submit();
			getLink(1);
		});
	});
	
	// 类型查询
	$("li.category_li").each(function(){
		$(this).click(function(){
			//清除关键字搜索
			$('#searchKeyHidden').val("");
			$('#search_key').val("");
			
			var categoryId = $(this).attr("categoryId");
			$("#categoryId").val(categoryId);
			//$("#product_search_form").submit();
			getLink(1);
		});
	});
	
	// 撤销所有条件筛选项
	$("#revoke_all_filter").click(function(){
		$("li.filter_li").each(function(){
			$(this).remove();
		});
		
		$("#product_search_form input").val('');
		
		$("#propertyFilter").val("");
		//$("#product_search_form").submit();
		getLink(1);
	});
	
	
	//tab function
	function TabSelect(tab,con,addClass,obj) {
		var jQuery_self = obj;
	    var jQuery_nav = jQuery(tab);
	
	    jQuery_nav.removeClass(addClass),
		jQuery_self.addClass(addClass);
	
	    var jQuery_index = jQuery_nav.index(jQuery_self);
	    var jQuery_con = jQuery(con);
	    jQuery_con.hide();
		jQuery_con.eq(jQuery_index).show();
	}

	// 最低-最高价格查询
	function minMaxPriceGo(e){
		var e = e || window.event; 
		if(e.keyCode == 13){ 
			var minPrice = $("#tmpMinPrice").val();
			if(!minPrice){
				minPrice = 0;
			}
			$("#minPrice").val(minPrice);
			
			var maxPrice = $("#tmpMaxPrice").val();
			if(!maxPrice){
				maxPrice = "999999999";
			}
			$("#maxPrice").val(maxPrice);
			
			if(parseInt(minPrice) > parseInt(maxPrice)){
				$("#tmpMaxPrice").val("");
				return false;
			}
			//$("#product_search_form").submit();
			getLink(1);
		}
	}
	/**
	 * 排序
	 */
	function doSort(sortField, sortType) {
		$(".xl_nav a").removeClass("current");
		$(this).addClass("current");
		
		$("#sortField").val(sortField);
		
		if(!sortType) {
			// 价格 升、降
			var nowType = $("#sortType").val();
			if('ASC' == nowType) {
				$("#sortType").val('DESC');
			} else {
				$("#sortType").val('ASC');
			}
		} else {
			$("#sortType").val(sortType);
		}
		getLink(1);
	}
</script>
<script type="text/javascript">
	
	
	/**
	 * 一级分类下多个小分类筛选
	 */
	function doProductSearch(categoryId) {
		
		var brandLabelArr = $(".brand_ul .brand_ul_" + categoryId + " label.checked");
		var brandIdStr = '';
		var bigCategoryId = '';
		if(brandLabelArr && brandLabelArr.length > 0) {
			for(var i = 0; i < brandLabelArr.length; i ++) {
				if(i == (brandLabelArr.length - 1)) {
					brandIdStr += brandLabelArr[i].title;
				} else {
					brandIdStr += brandLabelArr[i].title + ',';
				}
				bigCategoryId = $(brandLabelArr[i]).attr("big_category_id");
			}
		}
		var categoryArr = $(".xz_part .temp_ul_" + categoryId + " label.checked");
		var categoryIdStr = '';
		for(var i = 0; i < categoryArr.length; i ++) {
			categoryIdStr += categoryArr[i].title + ",";
			bigCategoryId = $(categoryArr[i]).attr("big_category_id");
		}
		if(categoryIdStr || brandIdStr) {
			//清除关键字搜索
			$('#searchKeyHidden').val("");
			$('#search_key').val("");
			$("#categoryId").val(categoryIdStr);
			$("#brandIds").val(brandIdStr);
			if(!categoryIdStr){
				// 如果类型为空，取大类
				$("#categoryId").val(bigCategoryId);
			}
			getLink(1);
		}
	}
</script>
<script language="JavaScript" type="text/javascript" src="<%=basePath%>/statics/js/sme.base.js"></script>
</body>
</html>